<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.vms.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>

<%
	Category cat;
	Integer catId;
	int totalpages,pageid=0;
	int pagerows=Page.getPageRows();
	int totalrows=0;
  String ordermode="desc";
  String orderfield="id";
	
	int check_rst=Permission.accept(dbi,session,request,"sysop","tree","catid","000000010"); 

	if(request.getParameter("ordermode")!=null)
		ordermode=request.getParameter("ordermode");	
	if(request.getParameter("orderfield")!=null)
		orderfield=request.getParameter("orderfield");	
	
	if (check_rst!=Permission.CHECK_RST_SUCCESS)
	{
		dbi.closeAll();
		if (check_rst==Permission.CHECK_RST_DENY)
			response.sendRedirect("../deny.html");
		else
			response.sendRedirect("../index.jsp");
		return;		
	}	
	
	String a=request.getParameter("catid");
	String str="";
	try {
		catId=Integer.valueOf(a);		
	} catch(NumberFormatException e) {
		out.println(e+"catId");
		return;
	}
	
	try {
		if (request.getParameter("pageid")!=null)
			pageid=Integer.parseInt(request.getParameter("pageid"));
	} catch(NumberFormatException e) {
		out.println(e+"pageid");
	}	
	
	try {
		if (request.getParameter("pagerows")!=null)
			pagerows=Integer.parseInt(request.getParameter("pagerows"));
	} catch(NumberFormatException e) {
		out.println(e+"pagerows");
	}	

	cat=new Category(dbi,catId.intValue());
	a=cat.getName();
	int userid=0;
	if(request.getParameter("userid")!=null)
		userid=Integer.parseInt(request.getParameter("userid"));
	totalrows=Class_User.getUserNoClassesNum(dbi,userid);
	totalpages = (int)Math.ceil((double)totalrows/pagerows);
	if(pageid>totalpages)
		pageid=totalpages;
	if(pageid<=1)
		pageid=1;
%>	
<html>
<head>
<title>show category </title>
<meta http-equiv="Content-Type" content="text/html; charset=<%=Language.getHTMLLanguageStr()%>">
<link rel="stylesheet" href="../css.css" type="text/css">
<SCRIPT language=JavaScript1.2 src="../script/Ion_Show.js"></SCRIPT>
<script language="javascript">
			function addUser()
			{
				var selectitem=selectlist();
				location.href="user_class_addmod.jsp?catid="+window.formIon.catid.value+"&userid="+window.formIon.userid.value+"&idtext="+selectitem;
			}			
</script>
</head>

<body bgColor=#d6d3ce leftMargin=0 
style="BORDER-BOTTOM: 0px outset; BORDER-LEFT: 0px outset; BORDER-RIGHT: 0px outset; BORDER-TOP: 0px outset" 
topMargin=0>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<FORM name="formIon" method="post" action="user_class_dj.jsp">
   	<tr>
    	<td>
    		<%=Language.getNameByCode("sys.class.list","class list")%><%=PageStr.getPageHead(totalrows,pageid,pagerows,totalpages)%>
    	</td>
     	<td align=right>
     		<%=PageStr.PageForm(pageid,totalpages)%><input type="submit" name="Submit" value="go" style="width:0">
      </td>
   	</tr>
	</table>

	<TABLE border=0 cellPadding=0 cellSpacing=1 height="100%" width="100%">
		<input type="hidden" name="catid" value="<%=catId%>">
		<input type="hidden" name="userid" value="<%=userid%>">
		<INPUT name="objid" type="hidden">
		<INPUT name="objtext" type="hidden">
		<INPUT name="actionurl" type="hidden">
		<input type="hidden" name="orderfield" value="<%=orderfield%>">
		<input type="hidden" name="ordermode" value="<%=ordermode%>">
  	<TR>
    <TD>
    <APPLET code=com.ionglobal.gui.Table codeBase=../ height="100%" name=table1 width="100%" VIEWASTEXT mayscript archive="gui.jar">
    <PARAM NAME="columnCount" VALUE="4">    
    <PARAM NAME="header" VALUE="no|<%=Language.getNameByCode("sys.class.id","ID")%>|<%=Language.getNameByCode("sys.class.name","Name")%>|<%=Language.getNameByCode("sys.class.descript","Descript")%>">
    <%	
  Vector vc=new Vector();
	vc=Class_User.getUserNoClasses(dbi,userid,pageid,pagerows,orderfield,ordermode);
	for (int i=0;i<vc.size();i++)
	{	
		Classes classes=(Classes)vc.get(i);
%>    <PARAM NAME="row_<%=i%>" VALUE="<%=classes.getId()%>|<%=classes.getId()%>|<%=classes.getName()%>|<%=(classes.getDescript()+" ")%>">
    <PARAM NAME="cellImage_<%=i%>_1" VALUE="../images/item.gif">
<%}
	Sysop sysop=Sysop.getSysop(dbi,userid);
%>   
		<PARAM NAME="sortMode" VALUE="<%=ordermode%>">
    <PARAM NAME="sortField" VALUE="<%=orderfield%>">
    <PARAM NAME="sortFieldList" VALUE="id,id,name,descript">    
    <PARAM NAME="fieldseparator" VALUE="|">
    <PARAM NAME="urlColor" VALUE="black">
    <PARAM NAME="urlStyle" VALUE="noline">
    <PARAM NAME="menu0" VALUE="<%=Language.getNameByCode("sys.class.add.sysop","Add new class to user")%>">
    <PARAM NAME="menuurl0" VALUE="javascript:addUser();">
    <PARAM NAME="separator0" VALUE="Y">
    <PARAM NAME="menu1" VALUE="<%=Language.getNameByCode("sys.Head.Refresh","Refresh")%>">
    <PARAM NAME="menuurl1" VALUE="">    
    <PARAM NAME="urltarget" VALUE="header1">
    <PARAM NAME="alternateRowBackground" VALUE="#D0E8FF">
    <PARAM NAME="font" VALUE="Arial,plain,12">
    <PARAM NAME="selectionMode" VALUE="multiple">
    <PARAM NAME="gridOn" VALUE="false">
    <PARAM NAME="gridColor" VALUE="#808080">
    <PARAM NAME="filterBarOn" VALUE="true">
    <PARAM NAME="columnWidth" VALUE="0,30,100,400">
    <PARAM NAME="totalRowOn" VALUE="true">
    <PARAM NAME="decimalCount_10" VALUE="0">
    <PARAM NAME="headerAlignment" VALUE="center,center,center,center">
    <PARAM NAME="columnAlignment" VALUE="left,left,left,left">
    <PARAM NAME="columnType" VALUE="number,text,text,text">
    <PARAM NAME="code" VALUE="com.ionglobal.gui.Table">
    <PARAM NAME="codeBase" VALUE="../">
    <PARAM NAME="height" VALUE="100%">
    <PARAM NAME="name" VALUE="table1">
    <PARAM NAME="width" VALUE="100%">
    <PARAM NAME="VIEWASTEXT" VALUE="">
    <PARAM NAME="mayscript" VALUE="">
    <PARAM NAME="archive" VALUE="gui.jar">
    </APPLET>
	  </TD>
 	</TR>
 	</FORM>
	</TABLE>
</body>
</html>
<%@ include file="../init_free.jsp" %>	
